<?php

namespace app\controller\system;

use app\BaseController;
use think\response\Json;

class Order extends BaseController
{
    public function lst(): Json
    {
        return $this->handle(function () {
            return $this->app->make(\app\model\Order::class)->pageData();
        });
    }

    public function detail(): Json
    {
        return $this->handle(function () {
            $param = request()->param();
            return $this->app->make(\app\model\Order::class)->with(['user', 'station', 'confirm'])->where('id', $param['id'])->find();
        });
    }

    public function refund(): Json
    {
        return $this->handle(function () {
            return $this->app->make(\app\model\Order::class)->refund();
        });
    }

    public function download(): Json
    {
        return $this->handle(function () {
            return $this->app->make(\app\model\Order::class)->download();
        });
    }
}
